import axios from 'axios';

const ajax = axios.create({
  baseURL: 'http://jsonplaceholder.typicode.com',
});

ajax.interceptors.request.use((req) => {
  return req;
});

ajax.interceptors.response.use((res) => {
  if (res.status === 200) {
    return res.data;
  }
  return Promise.reject(res);
});

export default ajax;
